home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
awe2-0_1.lha
/
awe2-0.1
/
Src
/
RCS
/
LowerBoundedFifo.cc,v
< prev
next >
Wrap
Text File
|
1989-05-09
|
2KB
|
151 lines
head 3.2;
branch ;
access ;
symbols ;
locks grunwald:3.2; strict;
comment @@;
3.2
date 89.02.20.15.35.54; author grunwald; state Exp;
branches ;
next 3.1;
3.1
date 88.12.20.13.48.58; author grunwald; state Exp;
branches ;
next 1.2;
1.2
date 88.10.30.13.04.31; author grunwald; state Exp;
branches ;
next 1.1;
1.1
date 88.09.18.16.42.26; author grunwald; state Exp;
branches ;
next ;
desc
@@
3.2
log
@Start using Gnu library heaps for schedulers
@
text
@// This may look like C code, but it is really -*- C++ -*-
//
// Copyright (C) 1988 University of Illinois, Urbana, Illinois
//
// written by Dirk Grunwald (grunwald@@cs.uiuc.edu)
//
#include "LowerBoundedFifo.h"
#include "CpuMultiplexor.h"
#include "stream.h"
#include "assert.h"
LowerBoundedFifo::LowerBoundedFifo(int defaultLength)
: (defaultLength), lowerBoundLock(0)
{
//
// do nothing
//
}
void LowerBoundedFifo::add(AwesimeFifoItem *t) {
LockedFifo::add(t);
lowerBoundLock.release();
}
bool
LowerBoundedFifo::remove(AwesimeFifoItem *item) {
(void) lowerBoundLock.reserve();
bool ok = LockedFifo::remove(item);
//
// The remove had better have worked, or there's something screwy
// with the semaphores.
//
assert(ok);
return(ok);
}
bool
LowerBoundedFifo::removeIfFound(AwesimeFifoItem *item) {
bool ok = LockedFifo::removeIfFound(item);
if (ok) {
(void) lowerBoundLock.reserve();
}
return(ok);
}
bool
LowerBoundedFifo::doDelete(AwesimeFifoIndex& index) {
//
// This is problematic. Since this is a LockedFifo, this person
// will be the only one with access to the list. If he blocks
// at this point, he's dead-meat.
//
// So, is this an error? If so, should we protect him?
//
bool whaHap = AwesimeFifo::doDelete(index);
if (whaHap) {
bool noBlock = lowerBoundLock.reserveNoBlock();
assert( noBlock );
}
return(whaHap);
}
unsigned int
LowerBoundedFifo::size()
{
return(AwesimeFifo::size());
}
void LowerBoundedFifo::classPrintOn(ostream& s)
{
s << "[LowerBoundedFifo " ;
s << "\tSemaphore\n";
s << lowerBoundLock;
s << "\n";
s << "\tFifo";
AwesimeFifo::classPrintOn(s);
s << "\n]\n" ;
}
@
3.1
log
@Steay version
@
text
@@
1.2
log
@*** empty log message ***
@
text
@@
1.1
log
@Initial revision
@
text
@d1 6
d8 1
d27 1
d30 5
a34 3
if (!ok) {
lowerBoundLock.release();
}
@